\documentclass{article}
\input code
\begin{document}

\begin{lstlisting}[style=c,morekeywords=slist_head]
/**
 * comment example
 */
void slist_reverse(struct slist_head *head)
{
	struct slist_head *prev, *next, *pos;

	assert(head->next != NULL);

	prev = head;
	pos = prev->next;

	while (pos != head) {
		next = pos->next;
		pos->next = prev;
		prev = pos;
		pos = next;
	}
	pos->next = prev;
}

\end{lstlisting}

\end{document}
